package com.haoze.nurseapp.dao;

import com.haoze.common.mapper.MyMapper;
import com.haoze.nurseapp.dto.OrderOperationLogDTO;
import com.haoze.nurseapp.dto.OrderPageDto;
import com.haoze.nurseapp.dto.PatientOrdersDTO;
import com.haoze.nurseapp.dto.order.OrderListAppDto;
import com.haoze.nurseapp.model.GeneralCheckLogEntity;
import com.haoze.nurseapp.model.OrderOperationLogEntity;
import com.haoze.nurseapp.model.PatientOrderCheckLogEntity;
import com.haoze.nurseapp.model.PatientOrdersEntity;
import com.haoze.nurseapp.vo.OrderDetailByOrderNoVo;
import com.haoze.nurseapp.vo.OrderInfo;
import com.haoze.nurseapp.vo.OrderInfoByInpatNoVo;
import com.haoze.nurseapp.vo.OrderReviewInfoByInpatVo;
import com.haoze.nurseapp.vo.order.OrderTaskInfo;
import org.apache.ibatis.annotations.Param;

import java.util.Collection;
import java.util.List;
import java.util.Map;

public interface OrderMapper {



	List<Map<String,String>> selectOrderType();

	List<OrderDetailByOrderNoVo> selectOrderDetail(String inpatorderdataId, String startDate, String endDate);


	/**
	 * 查询医嘱列表
	 * @param pageDto
	 * @return
	 */
	List<OrderInfoByInpatNoVo> queryOrderList(OrderPageDto pageDto);
	List<OrderInfoByInpatNoVo> queryOrderList1(OrderPageDto pageDto);


	/**
	 * 查询单个医嘱
	 * @param inpatorderdataId
	 * @return
	 */
	OrderInfoByInpatNoVo queryOrder(@Param("inpatorderdataId") String inpatorderdataId);

	/**
	 * 查询子医嘱
	 * @param inpatNum
	 * @param orderNo
	 * @return
	 */
	List<OrderInfoByInpatNoVo> querySubOrderList(@Param("inpatNum") String inpatNum, @Param("orderNo") String orderNo);

	/**
	 * 获取医嘱，关键节点（有子节点）的详细信息
	 * @param patOrdersId
	 * @return
	 */
	List<OrderTaskInfo> queryOrderTaskKey(String patOrdersId);

    //List<Map<String,String>> reviewList(@Param("inpatNums") String[] inpatNums, @Param("startDatetime") String startDatetime, @Param("endDateTime") String endDateTime);
    List<OrderReviewInfoByInpatVo> reviewList(@Param("inpatNums") String[] inpatNums, @Param("startDatetime") String startDatetime,
											  @Param("endDateTime") String endDateTime,@Param("switchFlag")  Boolean switchFlag,@Param("bedNo") String bedNo);


	List<Map<String,String>> queryPatientBedNoReviewList(@Param("wardDeptId") String wardDeptId,@Param("inpatList") String inpatList,@Param("switchFlag")  Boolean switchFlag,@Param("status") String status);
	List<Map<String,String>> queryPatientBedNoReviewedList(@Param("wardDeptId") String wardDeptId,@Param("inpatList") String inpatList, @Param("startDatetime") String startDatetime,
											  @Param("endDateTime") String endDateTime,@Param("switchFlag")  Boolean switchFlag,@Param("status") String status);

	PatientOrdersDTO queryPatientOrdersById(@Param("inpatorderdataId") String inpatorderdataId);

	int updatePatientOrderById(PatientOrdersEntity patientOrdersEntity);

    int updateBatchPatientOrderByIds(List<PatientOrdersEntity> patientOrdersEntity);

	List<String> notReviewPatientList(@Param("wardDeptId") String wardDeptId,@Param("status") String status,@Param("inpatList") String inpatList);

	//List<Map<String,Object>> reviewedList(@Param("inpatNums") String[] inpatNums, @Param("startDatetime") String startDatetime, @Param("endDateTime") String endDateTime);
	List<OrderReviewInfoByInpatVo> reviewedList(@Param("inpatNums") String[] inpatNums, @Param("startDatetime") String startDatetime, @Param("endDateTime") String endDateTime,
												@Param("bedNo") String bedNo);


	String queryWardDeptInfoByUserId(@Param("userId") String userId);
	String queryDeptNameByDeptId(@Param("deptId") String deptId);

    List<OrderListAppDto> queryOrderListApp(OrderPageDto pageDto);

	List<OrderListAppDto> selectOrdersByInpatAndOrderNo(@Param("inpatNum") String inpatNum, @Param("orderNo") String orderNo);


	List<OrderReviewInfoByInpatVo> ordersCheckList(@Param("inpatNums") String[] inpatNums,
												   @Param("startDatetime") String startDatetime,
												   @Param("endDateTime") String endDateTime,
	                                               @Param("orderType") String orderType);

	List<OrderReviewInfoByInpatVo> ordersCheckedList(@Param("inpatNums") String[] inpatNums,
												   @Param("startDatetime") String startDatetime,
												   @Param("endDateTime") String endDateTime,
												   @Param("orderType") String orderType);

	int updatePatientOrdersByInpatorderdataId(PatientOrdersEntity patientOrdersEntity);

	int insertPatientOrderCheckLogEntity(PatientOrderCheckLogEntity patientOrderCheckLogEntity);
	int insertPatientOrderCheckLogEntityList(List<PatientOrderCheckLogEntity> patientOrderCheckLogEntityList);

    List<String> queryFreqData(@Param("inpatorderdataId") String inpatorderdataId);


	List<OrderReviewInfoByInpatVo> ordersGeneralCheckList(@Param("inpatNums") String[] inpatNums,
												   @Param("dateTime") String dateTime,
												   @Param("orderType") String orderType);

	Integer ordersGeneralCheckListCount(@Param("inpatNums") String[] inpatNums,
														  @Param("dateTime") String dateTime,
														  @Param("orderType") String orderType);

	List<OrderReviewInfoByInpatVo> ordersGeneralCheckedList(@Param("inpatNums") String[] inpatNums,@Param("orderType") String orderType);

	int insertGeneralCheckLog(List<GeneralCheckLogEntity> generalCheckLogEntityList);

	int updateBatch(List<PatientOrdersEntity> ordersEntities);

	int insertOrderOperationLog(List<OrderOperationLogEntity> orderOperationLogEntityList);

	String queryUpdateStopDateLog(@Param("inpatorderdataId") String inpatorderdataId);

	List<OrderOperationLogDTO> queryUpdateStopDateLogByInpatorderdataId(@Param("inpatorderdataId") String inpatorderdataId);

	Map<String,String> selectInfusionTime(@Param("inpatorderdataId") String inpatorderdataId,@Param("qrCode") String qrCode);

	Map<String,String> selectInjectionTime1(@Param("inpatorderdataId") String inpatorderdataId,@Param("qrCode") String qrCode);
	Map<String,String> selectInjectionTime2(@Param("inpatorderdataId") String inpatorderdataId,@Param("qrCode") String qrCode);
	Map<String,String> selectInjectionTime3(@Param("inpatorderdataId") String inpatorderdataId,@Param("qrCode") String qrCode);
	Map<String,String> selectInjectionTime4(@Param("inpatorderdataId") String inpatorderdataId,@Param("qrCode") String qrCode);
	Map<String,String> selectTakeTime(@Param("inpatorderdataId") String inpatorderdataId);
	Map<String,String> selectAtomizationTime(@Param("inpatorderdataId") String inpatorderdataId,@Param("qrCode") String qrCode);
	Map<String,String> selectBloodTime(@Param("inpatorderdataId") String inpatorderdataId);
	Map<String,String> selectNutritionTime(@Param("inpatorderdataId") String inpatorderdataId,@Param("qrCode") String qrCode);
	Map<String,String> selectCollectionTime(@Param("inpatorderdataId") String inpatorderdataId);

	List<Map<String, Object>> useMedicationList(@Param("inpatNum") String inpatNum,@Param("type") String type,@Param("keyWords") String keyWords);

	List<Map<String, Object>> inpRecByOrderId(@Param("orderId") String orderId,@Param("prescNum") String prescNum);

	String getHospAreaNo(String userId);

	String queryByPersonCode(String personCode);

	List<OrderInfoByInpatNoVo> queryOrdersBookKeeping(@Param("inpatNum") String inpatNum);

	String selectClinicalProjects(@Param("dataValue") String dataValue);
}
